import {request} from "./indexsd.js";
// 登录注册忘记密码
export function userLoginToken(data){
    let {stast} = data
    if(stast == 'login'){
        return request({
            url: `/login`,
            method:'post',
            data
        })
    }
    if(stast == 'register'){
        return request({
            url: `/register`,
            method:'post',
            data
        })
    }
    if(stast == 'forget'){
        return request({
            url: `/reset_password`,
            method:'post',
            data
        })
    }

}
// 获取验证码
export function getSendSms(data) {
    return request({
        url: `/send_sms`,
        method:'post',
        data
    })
}
// 获取用户信息
export function getUsetInof() {
    return request({
        url: `/me`,
        method:'get'
    })
}
// 获取网站信息
export function getWebInfo() {
    return request({
        url: `/info`,
        method:'get'
    })
}
// steam验证
export function getSteamHandle(redirectedFrom) {
    return request({
        url: `/steam/handle?${redirectedFrom}`,
        method:'get'
    })
}
// steam登录
export function getSteamHandleLogin(data) {
    data.verify =  Number(data.verify)
    return request({
        url: `/steam/bind`,
        method:'post',
        data
    })
}
// 刷新token
export function getRefreshToken(){
    return request({
        url: `/auth/refresh`,
        method:'post'
    })
}

// 绑定手机号
export function get_bind_mobile(data){
    return request({
        url: `/bind_mobile`,
        method:'post',
        data
    })
}
// 切换语言
export function get_setLanguage(data){
    return request({
        url: `/setLanguage`,
        method:'post',
        data
    })
}


export default {
    userLoginToken,
    getSendSms,
    getUsetInof,
    getWebInfo,
    getSteamHandle,
    getRefreshToken,
    getSteamHandleLogin,
    get_bind_mobile,
    get_setLanguage,
}
